﻿<%@ Page Language="C#" MasterPageFile="~/template.master" AutoEventWireup="true" CodeFile="Categories.aspx.cs" Inherits="admincp.Categories" Title="Quản lý danh mục" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Panel runat="server" ID="pnEditor" Visible="false">
        <div class="register-form">
        <h2>
            Thêm/Sửa danh mục</h2>
        <table>
            <tr>
                <td>
                    Tên danh mục *
                </td>
                <td>
                    <asp:TextBox ID="TextBoxName" runat="server" CssClass="text-input"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Mô tả
                </td>
                <td>
                    <asp:TextBox ID="TextBoxDescription" runat="server" CssClass="text-input"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="ButtonSubmit" runat="server" Text="Thêm danh mục" Width="120" Height="25" OnClick="ButtonSubmitClick" />
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    * là những trường bắt buộc phải nhập
                </td>
            </tr>
        </table>
    </div>
    </asp:Panel>
    <div class="clear"></div>
    <asp:Panel runat="server" ID="pnView" Visible="false">
        <div class="post-manage-view">
            <table>
                <tr>
                    <td>Mã danh mục</td>
                    <td>Tên danh mục</td>
                    <td>Mô tả</td>
                    <td>Số bài viết</td>
                    <td>Hành động</td>
                </tr>

                <asp:Repeater ID="RepeaterListCategory" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td><%#Eval("CatId") %></td>
                            <td><a href='Categories.aspx?id=<%#Eval("CatId") %>'><%#Eval("CatName") %></a></td>
                            <td><%#Eval("CatDescription") %></td>
                            <td><%#Eval("PostCount") %></td>
                            <td><a href='Categories.aspx?ac=edit&id=<%#Eval("CatId") %>'>Sửa</a> - <a href='Categories.aspx?ac=del&id=<%#Eval("CatId") %>' onclick="return ConfirmDelete();">Xóa</a></td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
        </div>
    </asp:Panel>
    <script type="text/javascript">
        function ConfirmDelete(){
            if(confirm("Are you sure to delete ?"))
            return true;
            return false;
        }
    </script>
</asp:Content>

